You are here: Programming guide > COM SDK fundamentals > Sample code > Document from hybrid part sample

Document from hybrid part sample

The following sample code can be used to retrieve the AMDocument object in Visual Basic for Applications when only the path of the hybrid part file is known.

Public Function GetAMDocumentFromHybrid(ByVal dr As AMDocumentRepository, docPath As String) As AMDocument
Dim fld As IAMFolder4
Dim fldPath As String
Dim docName As String
docName = Mid(docPath, InStrRev(docPath, "\") + 1)
fldPath = Left(docPath, InStrRev(docPath, "\"))
Set fld = dr.GetFSObject(dr.PathToID(fldPath))
Set GetAMDocumentFromHybrid = fld.Elements(EFF_HYBRIDDOCS).Item(docName)
End Function

www.bluecieloecm.com